package com.jjiang.bbmall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class MyRedissonConfig {

    /**
     * 所有对redisson的使用通过RedissonClient对象
     *
     * @return RedissonClient对象
     */
    @Bean(destroyMethod = "shutdown")
    RedissonClient redisson() {
        // 1. 创建配置
        Config config = new Config();
        config.useSingleServer().setAddress("redis://172.26.174.4:6379").setPassword("ouis.20020120");
        // 2. 创建实例
        return Redisson.create(config);
    }
}
